package com.axend.aerosense.room.ui.fragment;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.axend.aerosense.base.fragment.MvvmBaseFragment;
import com.axend.aerosense.base.viewmodel.BaseViewModel;
import com.axend.aerosense.common.util.FragmentUtil;
import com.axend.aerosense.room.R;
import com.axend.aerosense.room.databinding.RoomFragmentSceneLearnSuccessBinding;
import com.axend.aerosense.room.ui.activity.RoomSceneLearnActivity;

import org.jetbrains.annotations.NotNull;

public class RoomSceneLearnSuccessFragment extends MvvmBaseFragment<RoomFragmentSceneLearnSuccessBinding, BaseViewModel> {

    @Override
    public void onViewCreated(@NonNull @NotNull View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        initView();
    }

    private void initView() {
        ((RoomSceneLearnActivity)getActivity()).setBack(false);
        ((RoomSceneLearnActivity)getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(false);//左侧添加一个默认的返回图标
        ((RoomSceneLearnActivity)getActivity()).getSupportActionBar().setHomeButtonEnabled(false); //设置返回键可用
        viewDataBinding.roomButFail.setOnClickListener(v->{
            getActivity().finish();
//            RoomSceneLearnFailFragment fragment = RoomSceneLearnFailFragment.getInstance();
//            FragmentUtil.add(getActivity(),((RoomSceneLearnActivity)getActivity()).getContentId(),fragment,this,true);
        });
    }

    public static RoomSceneLearnSuccessFragment getInstance(){
        RoomSceneLearnSuccessFragment fragment = new RoomSceneLearnSuccessFragment();
        return fragment;
    }
    @Override
    public int getLayoutId() {
        return R.layout.room_fragment_scene_learn_success;
    }

    @Override
    public int getBindingVariable() {
        return 0;
    }

    @Override
    protected BaseViewModel getViewModel() {
        return null;
    }

    @Override
    protected void onRetryBtnClick() {
        ((RoomSceneLearnActivity)getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(false);//左侧添加一个默认的返回图标
        ((RoomSceneLearnActivity)getActivity()).getSupportActionBar().setHomeButtonEnabled(false); //设置返回键可用
    }
}
